package com.wapper;

public class str1 {

    public static void main(String[] args) {

        System.out.println("排序前");
        String s1="abcdef";
        try {
            s1=fanzhuan(s1,1,7);
            System.out.println(s1);

        } catch (Exception e) {
            System.out.println(e.getMessage());
        }


    }

    public static String fanzhuan(String str ,int sta ,int end){
        char []c1=str.toCharArray();
        char tmp=' ';
        if (sta < 0 || end >= str.length() || sta > end) {
            throw new IllegalArgumentException("参数不正确");
        }
        for(int i=sta , j=end;i<j;i++,j--){

                 tmp =c1[i];
                  c1[i]=c1[j];
                  c1[j]=tmp;
        }

  return new String(c1);
    }
}